<!DOCTYPE html>
<html>
<head>
	<title>E8NET</title>
    
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <include file="./App/Admin/View/Include/css.html" />
    <!-- this page specific styles -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/personal-info.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

    <include file="./App/Admin/View/Include/navbar.html" />
    <include file="./App/Admin/View/Include/menu.html" />

	<!-- main container .wide-content is used for this layout without sidebar :)  -->
    <div class="content">

        <div role="breadcrumb">
            <ol class="breadcrumb">
              <li><a href="{:U('Dashboard/index')}">仪表盘</a> / </li>
              <li class="active">修改个人资料</li>
            </ol>
        </div>

        <div class="container-fluid">
            <div class="settings-wrapper" id="pad-wrapper">
                <!-- avatar column -->
                <div class="span2 avatar-box">
                    <div class="personal-image" style="text-align: center;">
                        <img src="{$Think.session.admin.photo}" class="avatar img-circle" />
                        
                        <div class="">
                            <div id="filelist">请选择一个文件.</div>
                            <div id="container">
                                <a id="pickfiles" href="javascript:;">[选择图片]</a>
                                <a id="uploadfiles" href="javascript:;">[上传图片]</a>
                            </div>
                            <label style="font-size:12px; color: #6e354a;" id="console">图片大小不要超过1MB</label>
                        </div>

                    </div>
                </div>

                <!-- edit form column -->
                <div class="span7 personal-info">
                    <h5 class="personal-title">个人详细信息修改</h5>

                    <form id="sadmin-form" />
                        <input type="hidden" name="id" value="{$Think.session.admin.id}" />
                        <input type="hidden" name="photo" id="photo" />
                        <div class="field-box">
                            <label>登录账号:</label>
                            <input class="span5 inline-input" type="text" value="{$Think.session.admin.account}" readonly />
                        </div>
                        <div class="field-box">
                            <label>个人邮箱:</label>
                            <input class="span5 inline-input" name="email" type="text" value="{$Think.session.admin.email}" />
                        </div>
                        <div class="field-box">
                            <label>移动电话:</label>
                            <input class="span5 inline-input" name="telphone" type="text" value="{$Think.session.admin.telphone}" />
                        </div>
                        <div class="field-box">
                            <label>真实姓名:</label>
                            <input class="span5 inline-input" name="tname" type="text" value="{$Think.session.admin.tname}" />
                        </div>

                        <div class="field-box">
                            <label>登录密码:</label>
                            <input class="span5 inline-input" name="password" type="password" value="default" />
                        </div>
                        <div class="field-box">
                            <label>确认登录密码:</label>
                            <input class="span5 inline-input" name="tpassword" type="password" value="default" />
                        </div>
                        <div class="span6 field-box actions">
                            <a href="javascript:void(0);" onclick="submitForm('sadmin-form','__ACTION__')" class="btn-flat default" >保存修改</a>
                            <a href="{:U('Index/index')}" class="btn-flat gray" >放弃</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- end main container -->

    <include file="./App/Admin/View/Include/js.html" />
    <include file="./App/Admin/View/Include/modal.html" />

    <script type="text/javascript" src="__PUBLIC__/Libs/plupload/plupload.full.min.js"></script>
    <script type="text/javascript">
        // Custom example logic

        var uploader = new plupload.Uploader({
            runtimes : 'html5,flash,silverlight,html4',
            browse_button : 'pickfiles', // you can pass in id...
            container: document.getElementById('container'), // ... or DOM Element itself
            url : '{:U("Public/upload")}',
            flash_swf_url : '__PUBLIC__/Libs/plupload/Moxie.swf',
            silverlight_xap_url : '__PUBLIC__/Libs/plupload/Moxie.xap',

            filters : {
                max_file_size : '1mb',
                mime_types: [
                    {title : "Image files", extensions : "jpg,gif,png,JPEG,JPG,PNG,GIF"},
                ]
            },

            init: {
                PostInit: function() {
                    document.getElementById('filelist').innerHTML = '';
                    document.getElementById('uploadfiles').onclick = function() {
                        uploader.start();
                        return false;
                    };
                },

                FilesAdded: function(up, files) {
                    plupload.each(files, function(file) {
                        document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
                    });
                },

                UploadProgress: function(up, file) {
                    document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
                },

                FileUploaded:function(up,file,result) {
                    var response =  $.parseJSON('' + result.response);
                    if (response.status == 1 || response.status == 2) {
                        document.getElementById("photo").value = response.path;
                    } else {
                        document.getElementById('console').innerHTML += "\nError #" + response.msg;
                    }
                },

                Error: function(up, err) {
                    document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
                }
            }
        });

        uploader.init();

    </script>

</body>
</html>